//@author A0087294-reused
#ifndef __FileOutput_h__
#define __FileOutput_h__

#include <iostream>
#include <fstream>

namespace logging {

    /*! \brief Provides an interface to the standard
     *         file output facilities of e.g. Linux
     *         or Windows.
     */
    class FileOutput {
            /*! \brief a plain filebufer */
            std::filebuf fb;
            /*! \brief and also a plain ostream */
            std::ostream os;
        public:
            /*! \brief The constructor opens the file, that should
             *         contain the output for writing.
             *
             *  \todo The name of the file should be configurable
             *        via a command line parameter.
             */
            FileOutput() : os(&fb) {
                fb.open ("test.txt", std::ios::out);
            }

            /*! \brief The destructor closes the file and therewith
             *         it should be persitent.
             */
            ~FileOutput() {
                fb.close();
            }

            /*! \brief operator that can output a simple character.
             *
             * \param c the character that needs to be outputed
             * \return a reference to itself allowing chaning of
             *         opertor<< calls.
             */
            FileOutput & operator<<(const char c) {
                os << c;
                return *this;
            }
    };

} /* logging */

#endif